package com.gmail.dmitryustimov.ms.observer.java8_lambda_inline;

public class Subscriber {

    String name;
    Writer writer;

    public Subscriber(Writer writer, final String name) {
        this.name = name;
        this.writer = writer;
        writer.bookEventPublisher.subscribe(
                (Book book) -> {
                    System.out.println(name + " is processing: " + book);
                }
        );
        writer.articleEventPublisher.subscribe(
                (Article article) -> {
                    System.out.println(name + " is processing: " + article);
                }
        );
    }
}
